home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.2r / card_13324.txt < prev    next >
Text File  |  1989-02-26  |  5KB  |  159 lines

  1. -- card: 13324 from stack: in.2r
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 13187
  5. -- name: Scroll Text Button 1
  6. ----- HyperTalk script -----
  7. on closecard
  8.   put empty into card field result
  9.   pass closecard
  10. end closecard
  11.  
  12.  
  13. -- part 6 (field)
  14. -- low flags: 01
  15. -- high flags: 0000
  16. -- rect: left=68 top=308 right=325 bottom=212
  17. -- title width / last selected line: 0
  18. -- icon id / first selected line: 0 / 0
  19. -- text alignment: 0
  20. -- font id: 3
  21. -- text size: 12
  22. -- style flags: 0
  23. -- line height: 16
  24. -- part name: Result
  25.  
  26.  
  27. -- part 7 (field)
  28. -- low flags: 00
  29. -- high flags: 4007
  30. -- rect: left=57 top=70 right=299 bottom=491
  31. -- title width / last selected line: 0
  32. -- icon id / first selected line: 0 / 0
  33. -- text alignment: 0
  34. -- font id: 3
  35. -- text size: 9
  36. -- style flags: 0
  37. -- line height: 12
  38. -- part name: description
  39. ----- HyperTalk script -----
  40. --
  41. -- Field script to allow special handling of option-clicked
  42. -- words in ANY text field, whether locked or unlocked
  43. --
  44. -- Guy Kuo, University of Nevada School of Medicine
  45. -- December 13, 1987
  46. --
  47. -- Use this script freely in your owns stacks but please retain the
  48. -- credit line
  49. --
  50. On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
  51.   -- If the the option key is depressed, set the cursor to indicate
  52.   -- we are in a special mode.  While the option key continues to be
  53.   -- depressed, and the mouse is within the target field, wait for
  54.   -- mouseDowns.  If one occurs, Pick up the word by clicking at the
  55.   -- last MouseLoc twice and getting the selection.
  56.   -- If the selection is not empty, do something with it.  In this demo,
  57.   -- we put it into another field.  Finally, click outside of the field
  58.   -- to avoid looping.  Hopefully, (-1,-1) is outside of all active
  59.   -- objects.
  60.   --
  61.   -- While editing such a field, entry of Optioned characters from
  62.   -- the keyboard no longer requires movement of the mouse outside of
  63.   -- the field.  However, the optioned characters do not appear until
  64.   -- after the option key is released
  65.  
  66.   if the OptionKey is down then
  67.     if the locktext of the target is true then
  68.       put true into DidUnlock
  69.       set locktext of target to false
  70.     else
  71.       put false into DidUnlock
  72.     end if
  73.     set the cursor to 2
  74.     repeat while (the OptionKey is down) and (item 1 of the rect of target <= item 1 of the mouseLoc) and (item 1 of the mouseLoc <= item 3 of the rect of target) and (item 2 of the rect of target <= item 2 of the mouseLoc) and (item 2 of the mouseLoc <= item 4 of the rect of target)
  75.       if the Mouse is down then
  76.         click at the MouseLoc
  77.         click at the ClickLoc
  78.         if the selection <> empty then
  79.           put the selection into card field "result"
  80.           -- or do something useful with it
  81.         end if
  82.         click at -1,-1
  83.       end if
  84.     end repeat
  85.     if DidUnlock then
  86.       set the locktext of the target to true
  87.     end if
  88.   end if
  89. end MouseWithin
  90.  
  91.  
  92.  
  93. -- part contents for background part 4
  94. ----- text -----
  95. 1
  96.  
  97. -- part contents for background part 2
  98. ----- text -----
  99. Scrolling Text Button 1
  100.  
  101. -- part contents for card part 7
  102. ----- text -----
  103. OPTION CLICK on any word in this field for an example of how this script works.
  104. --
  105. -- Field script to allow special handling of option-clicked
  106. -- words in ANY text field, whether locked or unlocked
  107. --
  108. -- Guy Kuo, University of Nevada School of Medicine
  109. -- December 13, 1987
  110. --
  111. -- Use this script freely in your owns stacks but please retain the
  112. -- credit line
  113. --
  114. On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
  115.   -- If the the option key is depressed, set the cursor to indicate
  116.   -- we are in a special mode.  While the option key continues to be
  117.   -- depressed, and the mouse is within the target field, wait for
  118.   -- mouseDowns.  If one occurs, Pick up the word by clicking at the
  119.   -- last MouseLoc twice and getting the selection.
  120.   -- If the selection is not empty, do something with it.  In this demo,
  121.   -- we put it into another field.  Finally, click outside of the field
  122.   -- to avoid looping.  Hopefully, (-1,-1) is outside of all active
  123.   -- objects.
  124.   --
  125.   -- While editing such a field, entry of Optioned characters from
  126.   -- the keyboard no longer requires movement of the mouse outside of
  127.   -- the field.  However, the optioned characters do not appear until
  128.   -- after the option key is released
  129.   
  130.   if the OptionKey is down then
  131.     if the locktext of the target is true then
  132.       put true into DidUnlock
  133.       set locktext of target to false
  134.     else
  135.       put false into DidUnlock
  136.     end if
  137.     set the cursor to 2
  138.     repeat while (the OptionKey is down) and¬¨
  139.       (item 1 of the rect of target <= item 1 of the mouseLoc) and¬¨
  140.       (item 1 of the mouseLoc <= item 3 of the rect of target) and¬¨
  141.       (item 2 of the rect of target <= item 2 of the mouseLoc) and¬¨
  142.       (item 2 of the mouseLoc <= item 4 of the rect of target)
  143.       if the Mouse is down then
  144.         click at the MouseLoc
  145.         click at the ClickLoc
  146.         if the selection <> empty then
  147.           --
  148.           --the selected word is now in 'selection'.  It's up to you to do something with it. 
  149.           --
  150.         end if
  151.         click at -1,-1
  152.       end if
  153.     end repeat
  154.     if DidUnlock then
  155.       set the locktext of the target to true
  156.     end if
  157.   end if
  158. end MouseWithin
  159.